<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <ul>
    <li>first</li>
    <li>second</li>
    <li>third</li>
    <li>fourth</li>
    <li>fifth</li>
  </ul>
</body>
<script>
  window.onload = function() {
    var ul = document.getElementsByTagName('ul')[0];
    ul.onclick = function(event) {
      var target = event.target;
      if(target.nodeName == 'LI' && target.innerText == 'first') {
        alert(1);
      } else if(target.nodeName == 'LI' && target.innerText == 'second') {
        alert(2);
      } else {
        alert('其他');
      }
    }
  }
</script>
</html>